/*
 * @Author: rxn 1003312535@qq.com
 * @Date: 2024-07-22 10:07:09
 * @LastEditors: rxn 1003312535@qq.com
 * @LastEditTime: 2024-07-22 10:09:46
 * @FilePath: \vue3-progect\src\views\example\three\helper\onResize.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/**
 * Canvas随着窗口变化
 * @param {Element} container dom对象
 * @param {Object} renderer 渲染实例
 * @param {Object} camera 摄像机
 */
export const onResize = (container, renderer, camera) => {
	window.onresize = () => {
		const width = container.offsetWidth;
		const height = container.offsetHeight;
		renderer.setSize(width, height);
		camera.aspect = width / height;
		camera.updateProjectionMatrix();
	};
};
